﻿(function () {
    var skillsInitialResolverFactory = function(skillsFactory, skillTypeFactory, $q) {
        return function(id) {
            var skills = skillsFactory.getSkills(id);
            var skillTypes = skillTypeFactory.getSkillTypes();

            return $q.all([skills, skillTypes]).then(function(results) {
                return {
                    skills: results[0],
                    skillTypes: results[1],
                    skillTypeId: id
                };
            });
        };
    };

    skillsInitialResolverFactory.$inject = ['skillsFactory', 'skillTypeFactory', '$q'];
    angular.module('app').factory('skillsInitialResolverFactory', skillsInitialResolverFactory);
}());